package com.chat.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * @Author: WFP
 * @Time: 2017/12/30
 * @decription:
 */
public class LogoutServlet extends HttpServlet {


    @Override
    public void init() throws ServletException {
        System.out.println("***Servlet初始化***");
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.getSession().invalidate();
        resp.sendRedirect("index.jsp");
    }

    @Override
    public void destroy() {
        System.out.println("***Servlet销毁***");
    }
}
